package ru.braim.weather_app.models;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import ru.braim.weather_app.models.enums.WeatherCondition;

import java.time.LocalDateTime;
import java.util.List;

@Entity
@Getter
@Setter
public class Weather {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @ManyToOne
    @JoinColumn(name = "region_id", nullable = false)
    private Region region;

    private Float temperature;

    private Float humidity;

    private Float windSpeed;

    @Enumerated(EnumType.STRING)
    private WeatherCondition weatherCondition;

    private Float precipitationAmount;

    private LocalDateTime measurementDateTime;

    @ManyToMany
    @JoinTable(name = "weather_and_weather_forecast",
            joinColumns = @JoinColumn(name = "weather_id"),
            inverseJoinColumns = @JoinColumn(name = "weather_forecast_id"))
    private List<WeatherForecast> weatherForecast;


}
